<!-- include ajax form updater -->
<script language="JavaScript" type="text/javascript" src="{$INA.adminTemplate}javascript/shopreports.js"></script>
<!-- end include ajax form updater -->

<h2>Filter</h2>
<form action="/admin/shopreports/" method="get">
<table cellspacing="0" align="center">
    <thead>
        <tr style="background: #eee;">
            <td align="right">From:</td>
            <td>{html_select_date prefix='from_' field_order='DMY' start_year='-2' time=$from}</td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td align="right">Until:</td>
            <td>{html_select_date prefix='until_' field_order='DMY' start_year='-2' time=$until}</td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td align="right">Supplier:</td>
            <td>
                <select name="supplier">
                    <option value="">-- All --</option>
                    {html_options options=$suppliers selected=$smarty.get.supplier}
                </select>
            </td>
        </tr>
        <tr style="background: #eee;">
            <td align="right">Order #:</td>
            <td><input type="text" name="order" value="{$smarty.get.order}" /></td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td align="right">Article:</td>
            <td>
                <select name="article">
                    <option value="">-- All --</option>
                    {html_options options=$articles selected=$smarty.get.article}
                </select>
            </td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            <td align="right">Paid:</td>
            <td>
                <select name="paid">
                    <option value="">-- All --</option>
                    <option value="yes" {if $smarty.get.paid == 'yes'}selected{/if}>Yes</option>
                    <option value="no" {if $smarty.get.paid == 'no'}selected{/if}>No</option>
                </select>
            </td>
        </tr>
        <tr style="background: #eee;">
            <td align="right">VAT:</td>
            <td>
                <select name="tax">
                    <option value="">-- All --</option>
                    {html_options options=$vats selected=$smarty.get.tax}
                </select>
            </td>
            <td colspan="6" align="center">&nbsp;</td>
        </tr>
        <tr style="background: #eee;">
            <td colspan="8" align="center"><input type="submit" value="Show!" name="show" /></td>
        </tr>
    </thead>
</table>
</form>



<h2>Data {if $sum}<span style="color: #999">(Total: {$sum|currency}&nbsp;&euro;)</span>{/if} {if $orders}<a href="{$INA.this}?{$INA.qs}&xls=true">.xls</a>{/if}</h2>
<!-- Left Rail -->
<div class="lCol">
    <div id="fresh_all">
        <table class="latest" cellspacing="0">
            <tbody>
            {foreach from=$orders item=order name=myOrders}
                {if $order.id != $prevOrder}
                    {if !$smarty.foreach.myOrders.first}
                                </p>
                            </td>
                        </tr>
                    {/if}
                <tr class="{cycle values="shade,noshade"}" id="group_{$order.id}">
                    <td class="icon">                        
                        <img alt="Public Users Group" src="{$INA.adminTemplate}images/stat_public.gif" align="middle">  
                        <div align="center"><strong>{$order.price|currency}&nbsp;&euro;</strong></div>
                    </td>
                    <td class="title" id="group_{$group.id}_data">
                        
                        <span id="group_{$group.id}_title">
                            <a class="messagelink glink" href="javascript: showOrderDetails({$order.id});">#{$order.id|ordernum} - {$order.name}</a>                            
                        </span>
                        
                        <p class="excerpt">
                {else}
                    <br />
                {/if}
                
                {assign var='prevOrder' value=$order.id}
                
                {$order.articlename} (Adults: {$order.quant1}{if $order.quant2}; Children: {$order.quant2};{/if} &mdash; <strong>Sum:</strong> {$order.price_adults*$order.quant1+$order.price_kids*$order.quant2|currency}&nbsp;&euro;)                            
            {foreachelse}
                <tr class="shade">
                    <td class="icon"><img alt="Not Available" src="{$INA.adminTemplate}images/stat_na.gif" align="middle"></td>
                    <td class="title">
                        No Orders found for the Current Filter
                    </td>
                </tr>
            {/foreach}
            
            {if $orders}
                        </p>
                    </td>
                </tr>
            {/if}
            </tbody>
        </table>
    </div>
</div>
<!-- End Left Rail -->

<!-- RIGHT RAIL -->
<div class="rCol">    
    <div class="SectionHeader" id="order_a"> </div>
    <div align="center" id="loading" style="display: none;">
        <img src="{$INA.adminTemplate}images/loading.gif" alt="Loading..." />
    </div>
</div>
<!-- END RIGHT RAIL -->